# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI="3"

inherit eutils

DESCRIPTION="Runtime library for the D programming language"

HOMEPAGE="http://www.digitalmars.com/d/"
SRC_URI="http://ftp.digitalmars.com/dmd.2.055.zip"

LICENSE="DMD"
SLOT="2"
KEYWORDS="~x86 ~amd64"
IUSE=""
EAPI="2"

RESTRICT="mirror"

PDEPEND="dev-lang/dmd
	dev-libs/druntime"

S="${WORKDIR}/dmd2/src/phobos"

src_unpack() {
    unpack ${A}
}

src_compile() {
	make -f posix.mak || die "make failed"
# clean up
	find . -name "*.asm" -print0 | xargs -0 rm -v
	find . -name "*.mak" -print0 | xargs -0 rm -v
	find . -name "*.txt" -print0 | xargs -0 rm -v
	find . -name "*.ddoc" -print0 | xargs -0 rm -v
	find . -name "*.c" -print0 | xargs -0 rm -v
}

src_install() {
# lib
	dolib.a "${S}/generated/linux/release/32/libphobos2.a" || die "Install failed"

# includes
	rm -rf "${S}/generated"
	rm -rf "${S}/dmd"
	dodir /usr/include/phobos2
	mv "${S}"/* "${D}/usr/include/phobos2/"
}
